package nc;

import java.util.Scanner;

public class Qhw1 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextLine()) {
            String nextLine = scanner.nextLine();
            int num = Integer.parseInt(nextLine);
            if (num == 0) {
                break;
            }
            System.out.println(drinks(num));
        }
    }

    private static int drinks(int num) {
        int drinks = num / 3;
        int remain = drinks + num % 3;
        if (remain < 2) {
            return drinks;
        }
        if (remain == 2) {
            return drinks + 1;
        }
        return drinks + drinks(remain);
    }
}
